home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / DYN401.ZIP / class / objassoc.c < prev    next >
C/C++ Source or Header  |  1997-04-16  |  3KB  |  134 lines

  1.  
  2.  
  3. /*  Copyright (c) 1993-1996 Algorithms Corporation  */
  4. /*  All rights reserved.  */
  5.  
  6.  
  7.  
  8.  
  9. /*  This file automatically generated by dpp - do not edit  */
  10.  
  11. #define    DPP_STRATEGY    2
  12. #define    DPP_FASTWIDE    0
  13.  
  14.  
  15.  
  16.  
  17. #define    CLASS    ObjectAssociation_c
  18. #define    ivType    ObjectAssociation_iv_t
  19.  
  20. #include "generics.h"
  21.  
  22. object    ObjectAssociation_c;
  23.  
  24.  
  25. #line 26 "objassoc.c"
  26. typedef struct  _ObjectAssociation_iv_t  {
  27.     object iValue;
  28. }    ObjectAssociation_iv_t;
  29.  
  30.  
  31.  
  32. #line 20 "objassoc.d"
  33. cmeth objrtn ObjectAssociation_cm_gNewWithObjObj(object self, object key, object val)
  34.     object assoc; 
  35.     ivType *iv; 
  36.  
  37.     ChkArgNul(key, 2); 
  38.     ChkArgNul(val, 3); 
  39.     assoc = oSuper(ObjectAssociation_c, gNewWithObj, self)(self, key); 
  40.     iv = ivPtr(assoc); 
  41.     iv->iValue = val; 
  42.     return assoc; 
  43.  
  44. imeth objrtn ObjectAssociation_im_gDeepCopy(object self)
  45. { ObjectAssociation_iv_t *iv = GetIVs(ObjectAssociation, self);
  46.     object nobj; 
  47.  
  48.     nobj = oSuper(ObjectAssociation_c, gDeepCopy, self)(self); 
  49.     ivPtr(nobj)->iValue = iv->iValue ? gDeepCopy(iv->iValue) : NULL; 
  50.     return nobj; 
  51.  
  52. imeth objrtn ObjectAssociation_im_gValue(object self)
  53. { ObjectAssociation_iv_t *iv = GetIVs(ObjectAssociation, self);
  54.     return iv->iValue; 
  55.  
  56. imeth objrtn ObjectAssociation_im_gChangeValue(object self, object value)
  57. { ObjectAssociation_iv_t *iv = GetIVs(ObjectAssociation, self);
  58.     object ret; 
  59.     ChkArgNul(value, 2); 
  60.     ret = iv->iValue; 
  61.     iv->iValue = value; 
  62.     return ret; 
  63.  
  64. imeth objrtn ObjectAssociation_im_gDeepDispose(object self)
  65. { ObjectAssociation_iv_t *iv = GetIVs(ObjectAssociation, self);
  66.     if (iv->iValue) 
  67.         gDeepDispose(iv->iValue); 
  68.     return oSuper(ObjectAssociation_c, gDeepDispose, self)(self); 
  69.  
  70. imeth objrtn ObjectAssociation_im_gStringRepValue(object self)
  71. { ObjectAssociation_iv_t *iv = GetIVs(ObjectAssociation, self);
  72.     object s, k, v; 
  73.  
  74.     k = gKey(self); 
  75.     k = k ? gStringRepValue(k) : gNewWithStr(String,"(null)"); 
  76.     v = iv->iValue ? gStringRepValue(iv->iValue) : gNewWithStr(String,"(null)"); 
  77.     s = vBuild(String, "( ", k, ", ", v, " )", NULL); 
  78.     gDispose(k); 
  79.     gDispose(v); 
  80.     return s; 
  81.  
  82.  
  83. #line 91 "objassoc.c"
  84.  
  85. objrtn    ObjectAssociation_initialize(void)
  86. {
  87.     static  CRITICALSECTION  cs;
  88.     static  int volatile once = 0;
  89.  
  90.     ENTERCRITICALSECTION(_CI_CS_);
  91.     if (!once) {
  92.         INITIALIZECRITICALSECTION(cs);
  93.         once = 1;
  94.     }
  95.     LEAVECRITICALSECTION(_CI_CS_);
  96.  
  97.     ENTERCRITICALSECTION(cs);
  98.  
  99.     if (ObjectAssociation_c) {
  100.         LEAVECRITICALSECTION(cs);
  101.         return ObjectAssociation_c;
  102.     }
  103.     INHIBIT_THREADER;
  104.     LookupKey_initialize();
  105.     if (ObjectAssociation_c)  {
  106.         ENABLE_THREADER;
  107.         LEAVECRITICALSECTION(cs);
  108.         return ObjectAssociation_c;
  109.     }
  110.     ObjectAssociation_c = gNewClass(Class, "ObjectAssociation", sizeof(ObjectAssociation_iv_t), 0, LookupKey, END);
  111.     cMethodFor(ObjectAssociation, gNewWithObjObj, ObjectAssociation_cm_gNewWithObjObj);
  112.     iMethodFor(ObjectAssociation, gValue, ObjectAssociation_im_gValue);
  113.     iMethodFor(ObjectAssociation, gStringRepValue, ObjectAssociation_im_gStringRepValue);
  114.     iMethodFor(ObjectAssociation, gChangeValue, ObjectAssociation_im_gChangeValue);
  115.     iMethodFor(ObjectAssociation, gDeepDispose, ObjectAssociation_im_gDeepDispose);
  116.     iMethodFor(ObjectAssociation, gDeepCopy, ObjectAssociation_im_gDeepCopy);
  117.  
  118.     ENABLE_THREADER;
  119.  
  120.     LEAVECRITICALSECTION(cs);
  121.  
  122.     return ObjectAssociation_c;
  123. }
  124.  
  125.  
  126.  
  127.